// 新增文件
import { Common } from "@k8slens/extensions";
import { observable, makeObservable } from "mobx";

export type IngressCheckPreferencesModel = {
  expiryDays: number;
};

export class IngressCheckPreferencesStore extends Common.Store
  .ExtensionStore<IngressCheckPreferencesModel> {
    
  @observable expiryDays = 30;

  constructor() {
    super({
      configName: "ingress-check-preference-store",
      defaults: {
        expiryDays: 30
      },
    });
    makeObservable(this);
  }

  fromStore({ expiryDays }: IngressCheckPreferencesModel = { expiryDays: 30 }): void {
    this.expiryDays = expiryDays;
  }

  toJSON(): IngressCheckPreferencesModel {
    return {
      expiryDays: this.expiryDays
    };
  }
}

export const ingressCheckPreferencesStore = new IngressCheckPreferencesStore();